/// RBFDEFORMER source code
/// by Alvaro Cuno, LCG-COPPE-UFRJ 
/// bugs? email-me: alvaroecp@gmail.com
/// Feb, 2008

#ifndef __DEFORMATION_MESH_H__
#define __DEFORMATION_MESH_H__

#include "../typedefs.h"
#include "../enumtypes.h"
#include "constraints.h"
#include "mesh.h"
#include "RBFfunction.h"

#include <cpplapack.h>

class DeformationMesh {
   
   typedef CPPL::dgematrix    MatrixCPPL;   ///< A CPPLapack matrix
   typedef CPPL::dcovector    VectorCPPL;   ///< A CPPLapack column vector
   
public:
   /// Constructors
   DeformationMesh();
   DeformationMesh(Mesh *model);
   virtual ~DeformationMesh();
   
   /// Sets the mesh to be deformed
   void setMesh(Mesh *m);
   
   /// Prepares the deformer to compute the deformation
   void setting(const Constraints *constraints);
   
   /// Executes the MLS-deformation induced by the deformed constraints
   ///@param constraints pointer to current constraints positions
   void execute_deformation(const Constraints *constraints);
   
protected:
   
   Mesh                   *model;
   RBFfunction            *rbf;
   vector<Point3>         ipositions; // initial vertex positions
   vector<Vector3>        inormals;   // initial vertex normal
};

#endif
